<template>
  <div>
    <header>
        <div class="top">
            <p><img src="../../assets/home-images/画板.png" alt=""><span>郑州</span></p>
            <p><img src="../../assets/home-images/x.png" alt=""></p>
        </div>
        <div class="bottom">
            <van-search v-model="value" shape="round" background="#5FCBBB" placeholder="搜索"/>
        </div>
    </header>
    <main>
        <section class="section1">
            <img src="https://lanhu.oss-cn-beijing.aliyuncs.com/SketchPng0984d177f93729a4f66ccb2ce5a680c7f2188a87d25f020aba1bd092b7eb225d" alt="">
        </section>
        <section class="section2">
            <figure v-for="(item,index) in nameList" :key="index">
                <figcaption @click="send(item)">
                    <img :src="list[index].img"/>
                    <p>{{item.typeName}}</p>
                </figcaption>
            </figure>
        </section>
        <section class="section3">
            <div class="div">
                <div class="one">
                    <p>即刻达</p>
                    <span>最快30分钟上门</span>
                </div>
                <div class="two">
                    <figure v-for="(item,index) in nowList" :key="index">
                        <figcaption @click="todetail(item.id)">
                            <img :src="list2[index].img"/>
                            <p>{{item.serviceName}}</p>
                        </figcaption>
                    </figure>
                </div>
            </div>
        </section>
        <section class="section4">
            <div>
                <h3>家庭保洁</h3>
                <div class="box">
                    <figure v-for="(item,index) in cleanList" :key="index">
                        <figcaption @click="tobaojie(item.id)">
                            <img :src="list3[index].img"/>
                            <p>{{item.serviceName}}</p>
                            <span>{{item.price}}元/小时</span>
                        </figcaption>
                    </figure>
                </div>
            </div>
        </section>
    </main>
  </div>
</template>

<script>
import {mapState,mapActions} from 'vuex'
export default {
    computed:{
        ...mapState("homes",["value","list","list2","list3","nameList","nowList","cleanList"])
    },
    created(){
        
        this.init();
    },
    methods:{
        ...mapActions("homes",["init"]),
        send(item){
            if(item.id==6){
                this.$router.push("/payment")
            }else{
                this.$router.push("/servelist/"+item.id)
            }
        },
        todetail(id){
            this.$router.push({path:"/itme/homemaintain/" ,
            query:{
                id,
                fatherid:2
            }})
        },
        tobaojie(id){
            this.$router.push({path:"/itme/homemaintain/" ,
            query:{
                id,
                fatherid:1
            }})
        },
    }
}
</script>

<style lang="scss" scoped>
header{
    height: 0.61rem;
    background-color: #5FCBBB;
    overflow: hidden;
    position: fixed;
    top: 0;
    width: 100%;
}
.top{
    height: 0.35rem;
    padding: 0 0.2rem;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    p{
        font-size:0.23rem;
        img{
            vertical-align: middle;
        }
        span{
            font-size: 0.14rem;
            margin-left: 0.08rem;
        }
    }
}
.bottom{
    padding: 0 0.08rem;
    box-sizing: border-box;
    margin-top: -0.18rem;
    .van-cell{
        line-height: 0.22rem;
    }
    .van-search__content--round {
        border-radius: 0.1rem;
        background-color: #fff;
    }
}
main{
    margin-top: 0.61rem;
    .section1{
        box-sizing: border-box;
        padding: 0 0.2rem;
        background:linear-gradient(#5FCBBB,#fff,#fff);
        img{
            margin-top: 0.1rem;
            width: 100%;
            height: 0.9rem;
        }
    }
    .section2{
        box-sizing: border-box;
        font-size: 0.12rem;
        display: flex;
        flex-wrap: wrap;
        figure{
            width: 25%;
            text-align: center;
            margin-bottom: 0.12rem;
            img{
                height: 0.41rem;
            }
        }
    }
    .section3{
        box-sizing: border-box;
        padding: 0 0.2rem;
        .div{
            width: 100%;
            height: 1.31rem;
            background: #F4F4F4;
            border-radius: 0.1rem;
            overflow: hidden;
            .one{
                height: 0.25rem;
                margin-top: 0.15rem;
                text-align: center;
                display: flex;
                justify-content: space-between;
                // background-color: rebeccapurple;
                p{
                    width: 0.76rem;
                    height: 0.25rem;
                    font-size: 0.18rem;
                    font-weight: 600;
                    color: #333333;
                    line-height: 0.25rem;
                }
                span{
                    height: 0.15rem;
                    font-size: 0.12rem;
                    color: #DD3D3D;
                    line-height: 0.14rem;
                    margin-right: 0.15rem;
                }
            }
            .two{
                display: flex;
                justify-content: space-between;
                box-sizing: border-box;
                padding: 0 0.1rem;
                font-size: 0.12rem;
                margin-top: 0.12rem;
                text-align: center;
                figure{
                    img{
                        height: 0.41rem;
                    }
                }
            }
        }
    }
    .section4{
        margin-top: 0.15rem;
        box-sizing: border-box;
        padding: 0 0.2rem;
        margin-bottom:0.6rem;
        div{
            // width: 332px;
            height: 1.97rem;
            background: #F4F4F4;
            border-radius: 0.1rem;
            overflow: hidden;
            h3{
                width: 0.91rem;
                height: 0.25rem;
                font-size: 0.18rem;
                font-weight: 600;
                color: #333333;
                line-height: 0.25rem;
                text-align: center;
                margin-top: 0.13rem;
            }
            .box{
                margin-top: 0.18rem;
                width: 100%;
                display: flex;
                justify-content: space-between;
                font-size: 0.14rem;
                text-align: center;
                padding:0 0.1rem;
                box-sizing: border-box;
                figure{
                    img{
                        width: 0.8rem;
                        height: 0.8rem;
                    }
                    p{
                        // font-size: 0.14rem;
                        font-weight: 600;
                        color: #333333;
                        margin-top:0.07rem;
                        line-height: 0.2rem;
                    }
                    span{
                        font-size: 0.1rem;
                        color: #333333;
                        line-height: 0.14rem;
                    }
                }
            }
        }
    }
}
</style>